<!--
/**************************************************/
/* Programmer: Scott Gildersleeve                 */
/*       Date: 2/14/2013                          */
/*  Page Name: GradeBook.php                      */
/*                                                */
/**************************************************/

/**************************************************/
/* Universal gradebook for students and teachers. */
/*                                                */
/**************************************************/

/**************************************************/
/*   Date        Reviser       Revision           */
/* --------     ---------     ----------          */
/*                                                */
/*                       	                      */ 
/*							                      */
/*							                      */
/*                                                */
/**************************************************/
-->
<link rel="stylesheet" type="text/css" href="css/template.css" />
<link rel="stylesheet" type="text/css" href="css/smoothness/jquery-ui-1.10.0.custom.css" />
<link rel="stylesheet" type="text/css" href="css/gradebook.css" />
<link rel="stylesheet" type="text/css" href="DataTables/media/css/demo_table.css" />
<script type="text/javascript" src="JQuery/jquery-1.9.0.min.js"></script>  
<script type="text/javascript" src="JQuery/jquery-ui-1.10.0.custom.js"></script>
<script type="text/javascript" charset="utf-8" src="DataTables/media/js/jquery.dataTables.js"></script>
<script>
	$(function() {
        $("#tabs").tabs({});
	    $(document).ready( function () {
            $('.table_class').dataTable({
	            "bJQueryUI": true	
            });
	    });
    });
</script>
<?php
   require("webservices.php");
   require("functions.php");
   
   session_start();
   
   $classesArray = array();

   $user_id      = $_SESSION['userid'];
   $classesArray = Get_class_info($user_id);
   $ctr = 0;
   
   echo '<div id="tabs">';
   echo '<ul>';
   // Loop Controling Tab Creation
   foreach($classesArray as $key=>$value)
   {
        $ctr++;
		foreach($value as $key2=>$value2)
		{
			if($key2 == 'full_name')
			{
				echo '<li><a href="#'.$ctr.'">'.$value2.'</a></li>';
	        }
        }
	}
	echo '</ul>';
	
	$ctr = 0;
	// Loop Controling Gradebook per Class
    foreach($classesArray as $key=>$value)
	{
        $ctr++;	
        echo '<div id="'.$ctr.'">';
			foreach ($value as $key2=>$value2)
			{
			   if($key2 == 'full_name')
			   {
	                echo '<table id="table_id" class="display table_class">';
		            echo '<thead>';
			           echo '<tr>';
                           echo '<th>'.'Students'.'</th>';
			            echo '</tr>';
			        echo '</thead>';
		            echo '<tbody>';
			        $studentsArray = Get_students_of_a_course($value['course_id']);
			        if ($key2 == 'full_name')
				    {
					    foreach ($studentsArray as $key3=>$value3)
					    {
			                echo '<tr>';
					            echo '<td>'.$value3['name'].'</td>';
				            echo '</tr>';
				        }
				    }
 			        echo '</tbody>';
		            echo '</table>';
			    }
			}
		echo '</div>';
	}
    echo '</div>';
?>